<template>
	<view class="team-list" v-if="memberList.length">
		<view class="top-bar">
			<view class="title">
				我的团队
			</view>
			<view class="more" @click="jump">
				查看更多 <i class="iconfont icon-arrow-right" />
			</view>
		</view>
		<view class="team-list-wrapper">
			<teamMemberItem v-for="item in memberList" :detail="item" :key="item.id"/>
		</view>
	</view>
</template>

<script lang="ts" setup>
	import teamMemberItem from '@/components/team-member-item/index';
	import { ITeamMember } from '@/components/team-member-item/types';
	import { onMounted, reactive } from 'vue';
	import { useStore } from 'vuex';
	import REST_URL from '@/http/http.restUrl';
	import { GET_STORE_USERINFO } from '@/store/gettersType';

	const store = useStore();

	const memberList : ITeamMember[] = reactive([]);



	onMounted(async () => {
		await uni.loginManger.$interceptor;
		getMyTeamMemberList();
	})

	const getMyTeamMemberList = async () => {
		const options = {
			customer_id: store.getters[GET_STORE_USERINFO].id,
			page: 1,
			page_num: 2,
		}

		const data = (await uni.http.POST(REST_URL.myTeamMemberList, options)).data;
		memberList.push(...data.data);
		console.log(data.data)
	}
	
	const jump = ()=>{
		uni.router.route('/pages_team/member_list/memberList');
	}
</script>

<style scoped lang="scss">
	@import "./teamList.scss";
</style>